Practice using ggplot and ggmap

bookstore

library(readr)

bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
##   .default = col_character(),
##   郵遞區號 = col_integer(),
##   經度 = col_double(),
##   緯度 = col_double(),
##   點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg

library(ggmap)
## Loading required package: ggplot2
map_4 <- get_map(location = c(lon = 120.5, lat = 23.625), zoom = 8)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=23.625,120.5&zoom=8&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_4) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 35 rows containing missing values (geom_point).

library(readr)

bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
##   .default = col_character(),
##   郵遞區號 = col_integer(),
##   經度 = col_double(),
##   緯度 = col_double(),
##   點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg

library(ggmap)
map_4 <- get_map(location = c(lon = 120.5, lat = 23.625), zoom = 8)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=23.625,120.5&zoom=8&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_4) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 35 rows containing missing values (geom_point).

ggmap(map_4, darken = c(0.5, "white")) +
  geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 35 rows containing missing values (geom_point).

library(readr)

bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
##   .default = col_character(),
##   郵遞區號 = col_integer(),
##   經度 = col_double(),
##   緯度 = col_double(),
##   點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg

library(ggmap)
map_5 <- get_map(location = c(lon = 121.576957, lat = 25.028702), zoom = 15)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=25.028702,121.576957&zoom=15&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_5) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 158 rows containing missing values (geom_point).

library(readr)

bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
##   .default = col_character(),
##   郵遞區號 = col_integer(),
##   經度 = col_double(),
##   緯度 = col_double(),
##   點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg

library(ggmap)
map_6 <- get_map(location = c(lon = 121.519872, lat =25.042141), zoom = 13)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=25.042141,121.519872&zoom=13&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_6) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 109 rows containing missing values (geom_point).

library(readr)

bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
##   .default = col_character(),
##   郵遞區號 = col_integer(),
##   經度 = col_double(),
##   緯度 = col_double(),
##   點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg

library(ggmap)
map_5 <- get_map(location = c(lon = 121.542709, lat = 25.026158), zoom = 15)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=25.026158,121.542709&zoom=15&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_5) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 129 rows containing missing values (geom_point).

library(readr)

bs <- read_csv("book.csv")
## Parsed with column specification:
## cols(
##   .default = col_character(),
##   郵遞區號 = col_integer(),
##   經度 = col_double(),
##   緯度 = col_double(),
##   點閱數 = col_integer()
## )
## See spec(...) for full column specifications.
lon.deg <- sapply((strsplit(as.character(bs$"經度"), ",")), as.numeric)
lat.deg <- sapply((strsplit(as.character(bs$"緯度"), ",")), as.numeric)
bs$lat <- lat.deg
bs$lon <- lon.deg

library(ggmap)
map_6 <- get_map(location = c(lon = 120.673648, lat =24.147736), zoom = 14)
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=24.147736,120.673648&zoom=14&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false
ggmap(map_6) + geom_point(aes(x = lon, y = lat), data = bs)
## Warning: Removed 148 rows containing missing values (geom_point).